class Dog():
    def __init__(self, name):
        self.name = name

    def say_hi(self):
        print(self.name + ': hi!')

    def set_name(self, new_name):
        self.name = new_name


class CaiDog(Dog):
    def __init__(self, name, age):
        super().__init__(name)
        self.age = age

    def info(self):
        print(self.name + ' age is ' + str(self.age))


class Person():
    def __init__(self, name):
        self.name = name
        self.dog = CaiDog('xiaohuang', 22)

    def info(self):
        print('my name is ' + self.name + '. I have a dog ' + self.dog.name)


dog = Dog('wangcai')
dog.say_hi()
dog.set_name('xiaohua')
dog.say_hi()

cd = CaiDog('facai', 3)
cd.info()
cd.say_hi()

p = Person('tf')
p.info()
